# -*- coding: utf-8 -*-
#
# Copyright (C) 2009, Aşkın Yollu <askin@askin.ws>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#

import Image

class ConvertImage:
    def __init__(self, fileName):
        self.fileName = fileName
        self.img = Image.open(fileName)
        self.append = '.rotated'
        self.angle = 90

    def setAngle(self, angle):
        ''' Method used when change size '''
        self.angle = angle

    def rotateImage(self):
        img2 = self.img.rotate(self.angle)
        newImageFile = self.fileName.rpartition('.')
        img2.save(newImageFile[0] + self.append + newImageFile[1] + newImageFile[2])

    def setAppend(self, append):
        self.append = append
